<?php
class categoryMod extends commonMod{
	//this class deal with the xml file
	protected $xmlPath = 'categoryData.xml';
	
	public function addNode(){
		
		$cate = new DOMDocument();
		$cate -> formatOutput = true;
		if($cate->load($xmlPath)){
			$root       = $cate->documentElement;
			$department = $cate->createElement('department');
			$function   = $cate->createElement('function');
						
			$id         = $cate->createAttribute('id');
			$level      = $cate->createTextNode('中文');
			$content   = $cate->createTextNode('中');
			
			$id         -> appendChild($level);
			$department -> appendChild($id);
			
			$function   -> appendChild($content);
		
			$department -> appendChild($function);
			
			$root       -> appendChild($department);
						
			$cate ->save($xmlPath);		
		}else{
			$this->error('部门数据导入出错，请重试，如果依然出错，请联系网络部！');
		}
	}
}

?>